#ifndef H264_YUVUTIL_H
#define H264_YUVUTIL_H

#ifdef __cplusplus
extern "C" {
#endif

void InitDecoder(int width, int height);
void DestroyDecoder();
void yuv420_to_rgb565(int screen_width, int screen_height, unsigned int *pdst1, unsigned char *y, unsigned char *u, unsigned char *v, int width, int height, int src_ystride, int src_uvstride, int dst_ystride);
int DecodeYUV_16(uint8_t *buf, int buf_size);
int GetPictureWidth();
int GetPictureHeigth();
char *GetPictureBuffer();
int GetPictureBuffferSize();

#define RGB565_MASK_RED        	0xF800   
#define RGB565_MASK_GREEN 		0x07E0   
#define RGB565_MASK_BLUE       	0x001F   

void rgb24_to_luminance(unsigned char *in, int size, unsigned char *out);
unsigned int rgb565_to_rgb24(unsigned short rgb565);
unsigned short rgb24_2_rgb565(int r, int g, int b);
void yuv420p_to_rgb565(int width, int height, unsigned char *src, unsigned short *dst);

#ifdef __cplusplus
}
#endif
#endif
